From 88a1d4d5a1e26545e9a69ef9d11d37f62b608e14 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 22 Mar 2012 17:44:54 -0400 Subject: [PATCH] x11: Deal better with L-shaped monitor arrangements The code for calculating the per-monitor workarea was ignoring the fact that the EWMH workarea property can only handle rectangular workareas, and thus can't really do justice to general monitor arrangements. As a workaround, we ignore it for anything but the primary monitor. And we ignore it for the primary monitor as well if it does not even cover it. https://bugzilla.gnome.org/show_bug.cgi?id=672163 --- gdk/x11/gdkscreen-x11.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/gdk/x11/gdkscreen-x11.c b/gdk/x11/gdkscreen-x11.c index c14e065d1b..a6d8ba6582 100644 --- a/gdk/x11/gdkscreen-x11.c +++ b/gdk/x11/gdkscreen-x11.c @@ -372,8 +372,19 @@ gdk_x11_screen_get_monitor_workarea (GdkScreen *screen, GdkRectangle workarea; gdk_x11_screen_get_monitor_geometry (screen, monitor_num, dest); - get_work_area (screen, &workarea); - gdk_rectangle_intersect (&workarea, dest, dest); + + /* The EWMH constrains workarea to be a rectangle, so it + * can't adequately deal with L-shaped monitor arrangements. + * As a workaround, we ignore the workarea for anything + * but the primary monitor. Since that is where the 'desktop + * chrome' usually lives, this works ok in practice. + */ + if (monitor_num == GDK_X11_SCREEN (screen)->primary_monitor) + { + get_work_area (screen, &workarea); + if (gdk_rectangle_intersect (dest, &workarea, &workarea)) + *dest = workarea; + } } static GdkVisual * -- 2.30.2